<?php
/* @var $this MstJnsAsuransiController */
/* @var $model MstJnsAsuransi */
/* @var $form TbActiveForm */
?>

<div class="form">

    <?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm', array(
	'id'=>'mst-jns-asuransi-form',
	// Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// There is a call to performAjaxValidation() commented in generated controller code.
	// See class documentation of CActiveForm for details on this.
	'enableAjaxValidation'=>false,
)); ?>

    <p class="help-block">Fields with <span class="required">*</span> are required.</p>
<div class="row">
					<!--=== Validation Example 1 ===-->
					<div class="col-md-6">
						<div class="widget box">
							<div class="widget-header">
								<h4><i class="icon-reorder"></i> Jenis Asuransi</h4>
							</div>
							<div class="widget-content">
    		<?php echo $form->errorSummary($model); ?>

    		<?php echo $form->dropDownListControlGroup($model,'no_type',CHtml::listData(MstCoa::model()->findAll("code like '%10A300%' and code!='10A300.00'"), 'id', 'name'),array('class'=>'form-control', 'prompt'=>'Pilih COA')); ?>	

            <?php echo $form->textFieldControlGroup($model,'name',array('class'=>'form-control','maxlength'=>50)); ?>


            <?php echo $form->textFieldControlGroup($model,'code',array('class'=>'form-control','maxlength'=>50)); ?>

            <?php echo $form->textAreaControlGroup($model,'remarks',array('class'=>'form-control','maxlength'=>50)); ?>
</div><!-- form -->
</div><!-- form -->
</div><!-- form -->

</div><!-- form -->
        <div class="form-actions">
        <?php echo TbHtml::submitButton($model->isNewRecord ? 'Create' : 'Save',array(
		    'color'=>TbHtml::BUTTON_COLOR_PRIMARY,
		    'size'=>TbHtml::BUTTON_SIZE_LARGE,
		)); ?>
    </div>

    <?php $this->endWidget(); ?>


</div><!-- form -->


<div id="myModalJkt" class="modal fade in" style="display: none;" aria-hidden="false">
												<div class="modal-dialog" style="width:700px;">
													<div class="modal-content">
														<div class="modal-header">
															<button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
															<h4 class="modal-title">Pilih COA Jakarta</h4>
														</div>
														<div class="modal-body">
															
															<?php echo $this->renderPartial('_viewCoaJakarta', array('model'=>$model2));  // I need $productId to by dynamic related to link 
                ?> 
														</div>
														<div class="modal-footer">
															<button data-dismiss="modal" class="btn btn-default" type="button">Close</button>
															<button id="btnCoaJakarta" data-dismiss="modal" class="btn btn-primary" type="button">Pilih</button>
														</div>
													</div><!-- /.modal-content -->
												</div><!-- /.modal-dialog -->
</div>



<div id="myModalMedan" class="modal fade in" style="display: none;" aria-hidden="false">
												<div class="modal-dialog" style="width:700px;">
													<div class="modal-content">
														<div class="modal-header">
															<button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
															<h4 class="modal-title">Pilih COA Medan</h4>
														</div>
														<div class="modal-body">
															
															<?php echo $this->renderPartial('_viewCoaMedan', array('model'=>$model3));  // I need $productId to by dynamic related to link 
                ?> 
														</div>
														<div class="modal-footer">
															<button data-dismiss="modal" class="btn btn-default" type="button">Close</button>
															<button id="btnCoaMedan" data-dismiss="modal" class="btn btn-primary" type="button">Pilih</button>
														</div>
													</div><!-- /.modal-content -->
												</div><!-- /.modal-dialog -->
</div>



<script type="text/javascript">
$(document).ready(function(){


$("#btnCoaJakarta").click(function()
{
	var nil = "";
    nil = $('input:radio[name=coajakarta]:checked').val();
   $("#coa_jakarta").val(nil);
   $("#mst_coa_id_jkt").val($('input:radio[name=coajakarta]:checked').attr('id'));
}); 


$("#btnCoaMedan").click(function()
{
	var nil = "";
    nil = $('input:radio[name=coamedan]:checked').val();
   $("#coa_medan").val(nil);
   $("#mst_coa_id_mdn").val($('input:radio[name=coamedan]:checked').attr('id'));
}); 

}); 
</script>

